package com.gc.server.vo.down;

import com.alibaba.excel.annotation.ExcelProperty;
import com.gc.server.enums.UserStatusEnum;
import com.gc.server.enums.UserVipEnum;
import com.gc.server.vo.UserVo;
import lombok.Data;

import java.util.Date;
@Data
public class UserDown {

    @ExcelProperty("名字")
    private String name;
    @ExcelProperty("编号")
    private String code;
    @ExcelProperty("手机号")
    private String mobile;
    @ExcelProperty("身份")
    private String level;
    @ExcelProperty("生日")
    private Date birth;
    @ExcelProperty("门店")
    private String shop;
    @ExcelProperty("连锁")
    private String link;
    @ExcelProperty("上级编号")
    private String topCode;
    @ExcelProperty("上级名字")
    private String topName;
    @ExcelProperty("省")
    private String province;
    @ExcelProperty("市")
    private String city;
    @ExcelProperty("县")
    private String county;
    @ExcelProperty("时间")
    private Date date;
    @ExcelProperty("兑费")
    private String vip;
    @ExcelProperty("状态")
    private String status;
    @ExcelProperty("注册时间")
    private Date join;



    public UserDown(UserVo userVo) {
        this.name = userVo.getUser().getName();
        this.code = userVo.getUser().getCode();
        this.topCode = userVo.getTop().getCode();
        this.topName = userVo.getTop().getName();
        this.mobile = userVo.getUser().getMobile();
        this.birth = userVo.getUser().getBirth();
        this.shop = userVo.getUser().getShopName();
        this.link = userVo.getUser().getLinkName();
        this.join = userVo.getUser().getJoinDate();
        if(userVo.getLevel()!=null){
            this.level  = userVo.getLevel().getName();
        }
        this.province = userVo.getUser().getProvince();
        this.city = userVo.getUser().getCity();
        this.county = userVo.getUser().getCounty();
        if(userVo.getUser().getVip()!=null){
            this.vip = UserVipEnum.indexOf(userVo.getUser().getVip());
        }
        if(userVo.getUser().getStatus()!=null){
            this.status = UserStatusEnum.indexOf(userVo.getUser().getStatus());
        }
        this.date = userVo.getUser().getJoinDate();
    }
}
